<?php
namespace Admin\Controller;
use Think\Controller;
class IndexController extends CommonController {
    public function index(){
		$this->display();
    }
	public function top(){

		$this -> display();

	}
	function left(){
		
		//获取当前登录的管理员信息
		$adid = $_SESSION['adid'];
		$adname = $_SESSION['admin'];
		$admin = D('admin')->find($adid);
		$role_id = $admin['roleid'];
		
		//根据管理员信息获取用户组及权限
		$role_info = D('Rule')->find($role_id);
		 $auth_ids = $role_info['role-ids'];

		
		//根据$auth_ids获取具体权限
		//父级权限
		//dump($auth_ids);
		//子级权限
		if($adname === 'admin'){
				$auth_infop = D('Auth')->where("level=0")->select();
				$auth_infoc = D('Auth')->where("level=1")->select();
		}else{
		$auth_infop = D('Auth')->where("level=0  and id in ($auth_ids)")->select();
		$auth_infoc = D('Auth')->where("level=1 and id in ($auth_ids)")->select();
		}
		$this->assign('auth_infop',$auth_infop);
		$this->assign('auth_infoc',$auth_infoc);
		//dump($admin);
		$this -> display();
 	}
	function main(){
		$s = new \Admin\Model\SysinfoModel(sys_info);
		$info = $s->getSysinfo();
		$this -> assign('sys',$info);
		$this -> display();
	}
	
	function notfound(){
		$this->display();
		}
	
	function help(){
		$this->display();
		}
}